package com.zombie.logic;

import com.zombie.ResourceManager;
import com.zombie.logic.object.LiveObject;

public class Reload implements Runnable {

	LiveObject obj;
	
	public Reload(LiveObject object) {
		obj =object;
	}

	@Override
	public void run() {
		if (obj.weapon.totalAmmo != 0 && obj.weapon.totalAmmo >= obj.weapon.maxAmmo){
			obj.weapon.ammo = obj.weapon.maxAmmo;
			if (obj.weapon.totalAmmo != Integer.MAX_VALUE)
				obj.weapon.totalAmmo -= obj.weapon.maxAmmo;
			ResourceManager.getSound(obj.weapon.clipinSound).play();
			obj.reload = null;
		}
	}
}